package com.qf.fanwang.service.impl;

import com.mysql.cj.xdevapi.Session;
import com.qf.fanwang.dao.GoodsDao;
import com.qf.fanwang.pojo.Goods;
import com.qf.fanwang.service.GoodsService;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.util.List;

public class GoodsServiceImpl  implements GoodsService {
private GoodsDao gsd;

    @Override
    public List<Goods> select() {
        try {
            SqlSession sqlSession = new SqlSessionFactoryBuilder().build(Resources.getResourceAsStream("mybatis.xml")).openSession(true);
            gsd=sqlSession.getMapper(GoodsDao.class);
            return gsd.select();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;

    }
}
